package com.wolves.career.service.impl;

import com.alibaba.excel.EasyExcel;
import com.wolves.career.entity.IndustryInformationClassification;
import com.wolves.career.entity.excel.InfoExcel;
import com.wolves.career.listener.ClassificationExcelListener;
import com.wolves.career.mapper.IndustryInformationClassificationMapper;
import com.wolves.career.service.IndustryInformationClassificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 麦翔盛
 * @since 2021-10-20
 */
@Service
public class IndustryInformationClassificationServiceImpl extends ServiceImpl<IndustryInformationClassificationMapper, IndustryInformationClassification> implements IndustryInformationClassificationService {
    /**
     * 读取文件
     * @param file 文件
     * @param service service类
     */
    @Override
    public void importClassificationData(MultipartFile file, IndustryInformationClassificationService service) {
        try {
            EasyExcel.read(file.getInputStream(), InfoExcel.class,new ClassificationExcelListener(service)).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
